<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                template="/WEB-INF/template/menu-template.xhtml">s

    <ui:define name="metadata">
        <ui:param name="menuIndex" value="1"/>
        <f:metadata>
            <f:viewAction action="#{postBean.initPostsData(null)}"/>
            <f:param name="dateFormat" value="yyyy/MM/dd"/>
        </f:metadata>
    </ui:define>

    <ui:define name="search">
        <p:inputText placeholder="Search" value="#{searchString}"  />
        <p:commandButton value="Search" action="#{postBean.initPostsData(searchString)}" update=":idForm" />
    </ui:define>

    <ui:define name="content">
        <h:form id="idForm">
            <div class="posts">
                <ui:repeat id="idRepeat" var="o" value="#{postBean.postsList}">
                    <p:panel styleClass="postPanel" style="margin-bottom:20px">
                        <h3>
                            <h:link value="#{o.title}" outcome="post">
                                <f:param name="id" value="#{o.id}"/>
                            </h:link>
                        </h3>
                        <div class="postText">
                            <h:outputText value="#{o.content}"/>
                            <h:link value="..." outcome="post" rendered="#{o.content.length() > 150}">
                                <f:param name="id" value="#{o.id}"/>
                            </h:link>
                        </div>

                        <h:outputText styleClass="createDate" value="#{o.createDate}">
                            <f:convertDateTime pattern="d-M-yyyy"/>
                        </h:outputText>

                        <h:outputText styleClass="author" value=" by "/>

                        <h:outputText styleClass="author" value="#{o.createdBy.firstName}"/>
                    </p:panel>
                </ui:repeat>
            </div>
            <div class="calendar">
                <p:calendar styleClass="indexCalendar" value="#{currentDate}" mode="inline"/>
            </div>

        </h:form>

    </ui:define>
</ui:composition>